package org.example.controller;

import org.example.entity.User;
import org.myspringmvc.stereotype.Controller;
import org.myspringmvc.ui.ModelMap;
import org.myspringmvc.web.bind.annotation.RequestMapping;
import org.myspringmvc.web.bind.annotation.RequestMethod;
import org.myspringmvc.web.servlet.ModelAndView;

/**
 * @author 莫磊
 * @date 2025/8/14
 * @description
 */
@Controller
public class TestController {

    @RequestMapping(value = "/test", method = RequestMethod.GET)
    public ModelAndView test(String path, User user, Integer count) {
        ModelAndView mv = new ModelAndView();
        ModelMap modelMap = new ModelMap();
        modelMap.addAttribute("user", user);
        modelMap.addAttribute("count", count);
        modelMap.addAttribute("path", path);
        mv.setViewName("test");
        mv.setModel(modelMap);
        return mv;
    }
}
